package cn.stylefeng.guns.modular.business.frequency.agreement.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import cn.stylefeng.guns.modular.business.frequency.agreement.model.param.AgreementEditParam;
import cn.stylefeng.guns.modular.business.frequency.agreement.model.param.AgreementPageParam;
import cn.stylefeng.guns.modular.business.frequency.agreement.service.AgreementService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 协议表 控制器
 *
 * @author: 李文龙
 * @date: 2021/10/28 13:58
 */
@RestController
public class AgreementController {

    @Resource
    private AgreementService agreementService;

    /**
     * 分页查询协议表
     *
     * @author 李文龙
     * @date 2021/10/28 13:58
     */
    @PostMapping("/agreement/page")
    @BusinessLog(title = "协议表_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(@RequestBody AgreementPageParam agreementParam) {
        return new SuccessResponseData(agreementService.page(agreementParam));
    }

    /**
     * 查看详情协议表
     *
     * @author 李文龙
     * @date 2021/10/28 13:58
     */
    @PostMapping("/agreement/detail")
    @BusinessLog(title = "协议表_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@RequestParam("id") Long id) {
        return new SuccessResponseData(agreementService.detail(id));
    }


    /**
     * 查看详情协议表
     *
     * @author 李文龙
     * @date 2021/10/28 13:58
     */
    @PostMapping("/agreement/edit")
    @BusinessLog(title = "协议表_编辑", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData edit(@RequestBody AgreementEditParam agreementEditParam) {
        agreementService.edit(agreementEditParam);
        return new SuccessResponseData();
    }


}
